package com.bwie.mq.consumer;

import com.jingtao.rabbitmq.constant.RabbitMQConstants;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 延迟队列消息消费者
 */
@Component
@Log4j2
public class DelayedQueueConfig {

    /**
     * 监听延迟队列消息
     *
     * @param msg 消息内容
     */
    @RabbitListener(queuesToDeclare = {@Queue(name = RabbitMQConstants.DELAYED_QUEUE_NAME)})
    public void delayedQueueConfig(String msg) {
        log.info("消费者接收到延迟队列消息，队列名称：{}，消息的内容：{}", RabbitMQConstants.DELAYED_QUEUE_NAME, msg);
    }

}
